package com.weilus;

import lombok.Data;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.time.LocalDateTime;


/**
 * @program test-springBoot
 * @date 2019-07-24 15:18
 **/
@Data
@ToString
@Document(indexName="test")
public class Article implements Serializable {

    @Id
    private Long id;

    /**
     * 标题
     */
    @Field(type = FieldType.Keyword,analyzer = "ik_smart",searchAnalyzer = "ik_smart",ignoreAbove = 256)
    private String title;
    /**
     * 作者
     */
    @Field(type = FieldType.Keyword,analyzer = "ik_smart",searchAnalyzer = "ik_smart",ignoreAbove = 256)
    private String author;

    /**
     * 内容
     */
    @Field(type = FieldType.Text)
    private String content;
    /**
     * 发表时间
     */
    @Field(type = FieldType.Date,format = DateFormat.custom,pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSZ")
    private LocalDateTime postTime;

}

